<!-- 选择产品图 -->
<template>
	<uni-popup ref="pickerView" type="bottom" :zIndex="999" background-color="transparent" :safeArea="false">
		<view class="popup-view">
			<view class="header">
				<view class="title flex">
					<view class="back">
						<u-icon name="arrow-left" :size="34" color="#333333"></u-icon>
					</view>
					<view class="">商品名称商品名称商品名称</view>
				</view>
			</view>

			<view class="list">
				<view :class="['item', selectIds.includes(item.id) ? 'act_item' : '']" v-for="item in dataSource.skuList" :key="item.id">
					<view class="cover">
						<image :src="item.cover" mode=""></image>
						<view :class="['sele_icon flex_center']">
							<image src="https://static.jinzhuangli.com/staticFile/images/0x72502201.png" mode=""></image>
						</view>
						<view class="view_icon" @tap.stop="viewImg(item.cover)">
							<image :src="$imgsUrl('0x725070111')" mode=""></image>
						</view>
					</view>
					<view class="info">
						<view class="u-line-2">
							{{ item.name }}
						</view>
					</view>
				</view>
			</view>

			<!-- 生成图片按钮 -->
			<generateCom />
			<!-- 生成图片按钮 -->
		</view>
	</uni-popup>
</template>

<script>
import generateCom from "./generate.vue";

export default {
	name: "selectSkuImg",
	components: { generateCom },
	props: {},
	data() {
		return {
			selectIds: ["11"],
			dataSource: {
				skuList: [
					{
						id: "11",
						name: "商品规格字段",
						cover: "https://img.ixintu.com/download/jpg/201911/e25b904bc42a74d7d77aed81e66d772c.jpg"
					},
					{
						id: "1133",
						name: "商品规格字段",
						cover: "https://img.ixintu.com/download/jpg/201911/e25b904bc42a74d7d77aed81e66d772c.jpg"
					},
					{
						id: "1122",
						name: "商品规格字段商品规格字段商品规格字段商品规格字段商品规格字段",
						cover: "https://img.ixintu.com/download/jpg/201911/e25b904bc42a74d7d77aed81e66d772c.jpg"
					}
				]
			}
		};
	},
	mounted() {},
	methods: {
		viewImg(url) {
			uni.previewImage({
				urls: [url]
			});
		},
		close() {
			this.$refs.pickerView.close();
		},
		open() {
			this.$refs.pickerView.open();
		},
		submit() {
			this.close();
		},
		change() {
			this.close();
		}
	}
};
</script>

<style lang="less" scoped>
.popup-view {
	width: 100%;
	min-height: 500rpx;
	background: #fff;
	border-radius: 24rpx 24rpx 0 0;
	padding: 0 0 calc(180rpx + env(safe-area-inset-bottom) / 2) 0;
	// border-radius: 24rpx 24rpx 0 0;
	// background: linear-gradient( 180deg, rgba(72,108,246,0.1) 0%, rgba(72,108,246,0) 100%);
}
.list {
	padding: 30rpx 30rpx 0 30rpx;
	display: flex;
	flex-wrap: wrap;
	--margin-item: calc((100% - 672rpx) / 2);
	:nth-child(3n).item {
		margin-right: 0;
	}
}
.item.act_item {
	border: 1px solid #486cf6;
	.sele_icon {
		border: none;
		image {
			transform: scale(1);
		}
	}
}
.item {
	width: 224rpx;
	padding: 8rpx;
	border-radius: 16rpx;
	border: 1px solid transparent;
	color: #333333;
	font-size: 28rpx;
	text-align: center;
	margin-right: var(--margin-item);
	margin-bottom: var(--margin-item);

	.sele_icon {
		width: 30rpx;
		height: 30rpx;
		border: 1px solid #777777;
		transition: all 0.2s;
		position: absolute;
		top: 16rpx;
		left: 16rpx;
		z-index: 3;
		border-radius: 50%;
		image {
			transform: scale(0);
		}
	}
	.info {
		height: 100rpx;
		padding: 16rpx 16rpx 0 16rpx;
		background-color: #fff;
	}
	.cover {
		width: 208rpx;
		height: 208rpx;
		border-radius: 16rpx;
		position: relative;
		overflow: hidden;
		.view_icon {
			padding: 8rpx;
			position: absolute;
			right: 0;
			bottom: 0;
			z-index: 3;
			image {
				width: 38rpx;
				height: 38rpx;
			}
		}
	}
}

.header {
	// box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.05);
	border-bottom: 1px solid #f5f5f5;
	.title {
		position: relative;
		padding: 38rpx 34rpx 46rpx 34rpx;
		font-size: #333333;
		font-weight: bold;
		font-size: 34rpx;
		padding-left: 88rpx;
		.back {
			position: absolute;
			left: 34rpx;
		}
	}
}
</style>
